package com.sundi.ecusers.web;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import com.sundi.eccommon.dto.EcUserDto;
import com.sundi.eccommon.vo.ResultEntity;
import com.sundi.ecusers.service.IEcSearchHistoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 搜索历史表 前端控制器
 * </p>
 *
 * @author Mht
 * @since 2020-02-26
 */
@RestController
@RequestMapping("/ecSearchHistory")
@CrossOrigin(origins = "*",allowCredentials = "true")
@Slf4j
public class EcSearchHistoryController {

    @Autowired
    IEcSearchHistoryService ecSearchHistoryService;

    @RequestMapping("getHistoryList")
    public ResultEntity getFeedbackList(Integer user_id, String keyword, EcUserDto userDto){
        PageHelper.startPage(userDto.getPageNum(),userDto.getPageSize());
        List historyList = ecSearchHistoryService.getHistoryList(user_id, keyword);
        PageInfo pageInfo = new PageInfo(historyList);
        return ResultEntity.ok(pageInfo);
    }
}


